I cannot separate the result from drive.getList()
I used pyDrive2 to get the name of all folders in the main folder:
foldered_list = drive.ListFile(
{'q': "'"+parent_directory_id+"' in parents and trashed=false"}).GetList()
for file in foldered_list:
print(file['title'])
and received the result:
my_new_folder
test2
test1
I tried to split them with splitlines() but didn't receive the result I wanted, the result was:
['my_new_folder']
['test2']
['test1']
I tried to use type() and received this:
<class 'str'>
<class 'str'>
<class 'str'>
How can I separate it into 3 individual strings?
Do you want a list
containing the three str
titles (which usaully is the best approach), or 3 separate strings, say s1
, s2
, s3
?
Both are easy to get:
#1st case
titles_list = [file["title"] for file in foldered_list]
#2nd case
s1, s2, s3 = [file["title"] for file in foldered_list]