I've come up with this:
try:
sys.argv[1]
x = sys.argv[1]
main(x)
except IndexError:
main(x)
It works but seems hackish.
Saad
On Monday, October 29, 2012, Saad Javed wrote:
> Hi,
>
> #!/usr/bin/env python
>
> import sys
>
> x = 'Saad is a boy'
>
> def main(x):
> a = []
> b = x.split(' ')
> for
Hi,
#!/usr/bin/env python
import sys
x = 'Saad is a boy'
def main(x):
a = []
b = x.split(' ')
for item in b:
a.append(item)
print a
if __name__ == '__main__':
x = sys.argv[1]
main(x)
How can I make this program run with the default value of x if I don't
specify an argument at the command line
On 29/10/2012 01:40, Matthew Ngaha wrote:
In your original getNames do something like this.
Initialise a counter to zero.
Every time you get a valid name increment the count.
If the count is three you're finished.
hey i was looking at the question as im learning also. With the counter,
would
>
> In your original getNames do something like this.
>> Initialise a counter to zero.
>> Every time you get a valid name increment the count.
>> If the count is three you're finished.
>>
> hey i was looking at the question as im learning also. With the counter,
would you use a while loop instead o
On 28/10/12 21:37, Sandra Beleza wrote:
def GetNames():
names=[]
while len(names)<3:
name=raw_input("Name: ")
if name in names:
print name, "is already in the data. Try again."
if name not in names:
names.append(name)
names.sort
On 28/10/12 17:41, Emile van Sebille wrote:
How can I use wxpython on python 3.3.0?
Actually, it looks to me that the v3.x compatible wxpython is being
rebranded as Project Phoenix
-- see http://wiki.wxpython.org/ProjectPhoenix
That's good news although two names for the same toolkit will c
On 28/10/2012 21:37, Sandra Beleza wrote:
Hi,
I have to write a script that asks the user for names one at a time, and
accept the name only if the user did not gave it before. The script has to
do this until it gets 3 unique names.
So far I have this:
def GetNames():
names=[]
while le
Hi,
I have to write a script that asks the user for names one at a time, and
accept the name only if the user did not gave it before. The script has to
do this until it gets 3 unique names.
So far I have this:
def GetNames():
names=[]
while len(names)<3:
name=raw_input("Name: ")
On 28/10/2012 17:41, Emile van Sebille wrote:
On 10/27/2012 2:19 PM, Alan Gauld wrote:
On 27/10/12 20:50, Amin Memar wrote:
Hi there!
How can I use wxpython on python 3.3.0?
You can't its not supported yet.
So you will need to either port the code yourself or use Python 2.7.
This is not unco
On 10/27/2012 2:19 PM, Alan Gauld wrote:
On 27/10/12 20:50, Amin Memar wrote:
Hi there!
How can I use wxpython on python 3.3.0?
You can't its not supported yet.
So you will need to either port the code yourself or use Python 2.7.
This is not uncommon with third party modules a lot of them are
10 matches
Mail list logo