files Flashcards

1
Q

in the terminal, get the path of file

A

pwd

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

return the directories and file

A

ls

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

return the directories and file with details

A

ls -la

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

muoversi da una directory all’altra

A

cd

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

open a file to a variable xxx

A

xxx=open(‘path’)

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

close a stream of a file linked to variable xxx (2 metodi)

A

xxx.close()

with open('path') as xxx:
    ........
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

iterate over lines (variable called xxx)

A

xxx=open(‘path’)
for line in xxx:
print(line)

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

create list with single characters of a string as elements

A
lines=[]
xxx=open('path')
for line in xxx:
  lines+= line
print(lines)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

create list with single lines of a string as elements

A
lines=[]
xxx=open('path')
for line in xxx:
  lines.append(line.strip())
print(lines)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

togliere spazi ed EOF da string

A

variablexxx.strip()

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

fare lista con le singole parole di una string

A

variablexxx.split()

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

read a tot number of characters

A

variablexxx.read (numberofcharachters)

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