Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: How to iterate over command line arguments?
Post: RE: How to iterate over command line arguments?

(Nov-20-2018, 07:01 AM)wavic Wrote: >>> type(sys.argv) <class 'list'>Iterating over a string returns each letter. for element in sys.argv: should do it. Thanks, I wound up using this ...
zBernie General Coding Help 5 16,018 Nov-23-2018, 05:00 AM
    Thread: How to handle paths with spaces in the name?
Post: How to handle paths with spaces in the name?

I've been searching and still cannot find a solution to this issue. Under Windows 10, using Python 3.7, I'm passing a comma separated argument to the script, which then splits the string, and prints ...
zBernie General Coding Help 1 6,743 Nov-22-2018, 03:47 AM
    Thread: How to iterate over command line arguments?
Post: RE: How to iterate over command line arguments?

(Nov-20-2018, 03:20 AM)ichabod801 Wrote: How does it not work? It works for me, although note that looping over a string loops over each character in the string. You did import sys, right? It's not ...
zBernie General Coding Help 5 16,018 Nov-20-2018, 03:55 AM
    Thread: How to iterate over command line arguments?
Post: How to iterate over command line arguments?

How do you iterate over arguments passed to a script? I'm trying to use sys.argv as shown below, which does not work. -Thanks print 'Number of arguments:', len(sys.argv), 'arguments.' print 'Argum...
zBernie General Coding Help 5 16,018 Nov-20-2018, 02:42 AM
    Thread: Why is subprocess.call command not working?
Post: RE: Why is subprocess.call command not working?

(Nov-19-2018, 09:02 PM)wavic Wrote: Line 4, 3 quotes. You have to break the command by spaces. command = "convert " + str(jpgfile) + " -font Helvetica -pointsize 60 -fill lightblue -quality 100 -gr...
zBernie General Coding Help 5 10,750 Nov-19-2018, 09:24 PM
    Thread: Why is subprocess.call command not working?
Post: Why is subprocess.call command not working?

In the code snippet below, the subprocess.call command generates the file not found error shown below. However, passing the same variable "command" to os.system works. I've read that subprocess is p...
zBernie General Coding Help 5 10,750 Nov-19-2018, 08:54 PM
    Thread: How to pass arguments to popen?
Post: RE: How to pass arguments to popen?

(Jul-08-2018, 05:10 AM)buran Wrote: subprocess.Popen(['C:\Program Files (x86)\XYplorer\XYplorer.exe', myfile])this way you pass the myfile variable, in your code (with the quotes) you pass the strin...
zBernie General Coding Help 3 12,884 Jul-09-2018, 01:26 AM
    Thread: How to pass arguments to popen?
Post: How to pass arguments to popen?

I'm trying to pass an argument to the popen function below. I've tried various permutations of syntax, and still can't get it working. What I ultimately want to do is pass an argument to the script,...
zBernie General Coding Help 3 12,884 Jul-08-2018, 04:46 AM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020