General Programming Flashcards

1
Q

stop a program from running in ide or command line.

A

command-C

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

open a file so it’s writeable in python

A

open(filename, ‘w’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

search for a specific spot in a file and cut everything off

A

target.truncate()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

write over a file in python

A

target.write(newline)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

copy and put contents of file in pasteboard

A

cat filename | pbcopy

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

print out file in command line

A

cat

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

pipe in command line

A

|

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

python: open a file name in read (default)

A

open(filename, ‘r’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

python: open file in write (overwrites everything)

A

open(filename, ‘w’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

python: open filename in append (adds to end)

A

open(filename, ‘a’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

copy contents of a file into command line

A

cat filename

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

pipe

A

|

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

copy contents of command line into pasteboard

A

cat filename | pbcopy

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

search for a specific spot in a file and cut everything off

A

target.truncate()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly