Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

how do you copy lines and then paste them within a file

like which keys would i use

1 Answer

mouseandweb
mouseandweb
13,758 Points

You may highlight the line using your mouse and then while holding down the ctrl key press c to copy. You can then move your cursor to the place you would like to paste the line and then, while holding down the ctrl key press v. This will paste the line or text in place.

Alternatively, you could use the keyboard to move your cursor to the text you want to highlight and hold shift key while pressing the left arrow or right arrow key to highlight the text. Then proceed to copying (ctrl+c) and pasting (ctrl+v).

Now, if you are simply looking to highlight an entire line with a keyboard shortcut:

  1. move the cursor to either end of the line.
    • you can use alt + left arrow key to move to the start of the line.
    • you can use alt + right arrow key to move to the end of the line.
  2. at either end of the line you may hold down both alt and shift and press:
    • right arrow if at start of line to highlight entire line.
    • left arrow if at end of line to highlight entire line.