Posts by Nasca • 319 points
13 posts
-
1
votes1
answer193
viewsQ: Python Using . replace() with list comprehension
Can someone tell me if I can make it work: a = ['<a1>', '<a2>', '<a3>', '', '<a5>'] b = ['<b1>', '<b2>', '<b3>', '', '<b5>'] txt = '<a1> test…
-
1
votes2
answers183
viewsQ: Batch file anchored
How do I get a batch anchored to a folder for a backup operation on a USB stick where the drive letter always changes example: @echo off mkdir ..\subs move /y .\*.srt ..\subs pause exit…
-
3
votes1
answer706
viewsQ: How to monitor changes in a folder?
How can I monitor and capture changes in folders and files? I intend to use this as part of a service that starts with the system the script would be in .pyw. example: if(mudou != padrao): pass…
-
0
votes1
answer4056
viewsQ: python progress bar 3
I’m trying to assemble a progress bar to tell the percentage of my Python script execution with varying different functions, however unsuccessfully how I would create such progress bar?
-
3
votes2
answers591
viewsQ: Start a command line tool in Python
How can I create a command line tool in Python that works like ls linux or dir windows? How would I start one script like the one that will later be compiled as an executable?…
-
4
votes1
answer2424
viewsQ: running split() to form a list within another list
have the following list: [['a:/, b:/, w:/, g:/, f:/, d:/Downloads/Torrent/End, x:/files.2t, y:/files.1t'], ['d:/Dropbox/project/rato_bat'], ['data']] however I would like it to be a list within…
-
0
votes2
answers117
viewsQ: list.remove() in a row
have the list: lista = ['', 'a', 'b', 'c', ' ', '', '', ' '] and from her I’m trying to remove the blank items: [''] or [' '] then I have the following code: if(ret_b == [' ']): ret_b.clear() my…
-
2
votes1
answer94
viewsQ: Delete list item if directory does not exist
I have a list containing the path of some directories, I want to check if each directory exists, for this I use the os.path.exists(), if a directory does not exist, I use the method remove() to…
-
1
votes2
answers63
viewsQ: Looping for as a looping parameter while
Whereas the list cont would have the values: cont = ['t','f','f','t','f'] It would be possible something like this: while(for cont in cont == 'f'): pass…
-
0
votes1
answer76
viewsQ: append string and looping 'for'
def conf_dir_exist(lines): temp = '' print(lines) #isso é uma tuple. for line_a in lines: for line_b in line_a: if(os.path.exists(line_b) != False): pass else: temp += ''.join(line_b + '; ')…
-
2
votes2
answers245
viewsQ: ignore in function call if empty
suppose I feed a function with a tuple: a = ['c:/', 'd:/', 'x:/', 'y:/'] b = ['c:/data', 'd:/data'] funcao((a, b)) however if you have an empty list you would like it to be ignored as an example:…
-
1
votes1
answer179
viewsQ: Move subfolders with python
Some time ago I was trying to create a script Python to move subdirectories from one folder to another for example: root ├── pasta1 │ ├── pastaa │ └── pastab ├── pasta2 └── pasta3 ├── pastac └──…
-
2
votes1
answer748
viewsQ: batch script - move parent directory and subdirectory
as I create a ".bat" to move all files in specific or better only those with extension ".txt" from one directory and all its subdirectories to another folder.…