473,378 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

passing python variables into shell commands as argv

1
Hi, I'd like to do the following things in python script

x = "file1"
y = "file2"

shell's commands x y

Is any one out there tell me how it get done.

Thanks
GIAO
Aug 4 '06 #1
1 12866
dpal
6
I think I am understanding you correctly...
you want to use 2 command line arguments in your script?
If so you will need to:

import sys
#assign arbuments to variables foo and bar
foo = sys.argv[1]
bar = sys.argv[2]
Aug 23 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

54
by: Brandon J. Van Every | last post by:
I'm realizing I didn't frame my question well. What's ***TOTALLY COMPELLING*** about Ruby over Python? What makes you jump up in your chair and scream "Wow! Ruby has *that*? That is SO...
4
by: rkoida | last post by:
Hello evryone I am a newbie to python. I have a makefile which i can compile in UNIX/LINUX, But i I am planning to write a python script which actually does what my MAKEFILE does. The make file...
11
by: ronan_boisard | last post by:
hi all, I'm trying to call ksh script from python. I have a file (toto.env) with a scirpt looking like: -- begin --- #!/bin/ksh # export TOTO_ENV=/home/toto -- end ---
2
by: Xah Lee | last post by:
Python Doc Problem Example: os.system Xah Lee, 2005-09 today i'm trying to use Python to call shell commands. e.g. in Perl something like output=qx(ls) in Python i quickly located the...
30
by: bblais | last post by:
Hello, Let me start by saying that I am coming from a background using Matlab (or Octave), and C++. I am going to outline the basic nuts-and-bolts of how I work in these languages, and ask for...
3
by: eight02645999 | last post by:
hi if i have a string like this "ABCE-123456 ABC_DEF_Suggest(abc def ghi).txt" that needs to be passed to a python script and i wanted to get the words inside the brackets after i passed...
1
by: theemails | last post by:
New to Python ... this should be an easy question to answer. INPUT import sys print 'The command line arguments are:' for i in sys.argv: print i
4
by: cjt22 | last post by:
Hi there. I just wondered whether anyone could recommend the correct way I should be passing command line parameters into my program. I am currently using the following code: def main(argv =...
3
by: R. Bernstein | last post by:
The next release of pydb will have the ability to go into ipython from inside the debugger. Sort of like how in ruby-debug you can go into irb :-) For ipython, this can be done pretty simply;...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.