8 Replies - 1802 Views - Last Post: 16 May 2012 - 02:39 AM Rate Topic: -----

#1 sai_saketh92  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 10-May 12

writing two python commands in one line in command window

Posted 13 May 2012 - 08:59 PM

can two python commands be written in one line in command window? actually the task is to write and read serially simultaneously ,there should not be any time gap between them ,therefore i need to type two commands at single time in command window.

ser.write('setphone-num1 09823232323')#-----------------setting phone number
ser.write('\r')
y=ser.read(37)
print y



this is in text editor ,but if i have to execute using command window then what is the solution?

Is This A Good Question/Topic? 0
  • +

Replies To: writing two python commands in one line in command window

#2 atraub  Icon User is offline

  • Pythoneer
  • member icon

Reputation: 759
  • View blog
  • Posts: 2,010
  • Joined: 23-December 08

Re: writing two python commands in one line in command window

Posted 14 May 2012 - 05:45 AM

if you're asking if two command line arguments can be passed in simultaneously, the answer is yes. Could you clarify your question?
Was This Post Helpful? 0
  • +
  • -

#3 sai_saketh92  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 10-May 12

Re: writing two python commands in one line in command window

Posted 14 May 2012 - 09:17 PM

View Postatraub, on 14 May 2012 - 05:45 AM, said:

if you're asking if two command line arguments can be passed in simultaneously, the answer is yes. Could you clarify your question?


yes,the question is what is the required syntax for the sending two commands simultaneously in command line?
Was This Post Helpful? 0
  • +
  • -

#4 atraub  Icon User is offline

  • Pythoneer
  • member icon

Reputation: 759
  • View blog
  • Posts: 2,010
  • Joined: 23-December 08

Re: writing two python commands in one line in command window

Posted 14 May 2012 - 09:34 PM

Here's a link to the argparse module, give it a try, if you run into problems, show us what you got. I'll probably write a tutorial on this soon.
Was This Post Helpful? 0
  • +
  • -

#5 sai_saketh92  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 10-May 12

Re: writing two python commands in one line in command window

Posted 14 May 2012 - 09:52 PM

View Postatraub, on 14 May 2012 - 09:34 PM, said:

Here's a link to the argparse module, give it a try, if you run into problems, show us what you got. I'll probably write a tutorial on this soon.


it's is going all Greek to me.
Was This Post Helpful? 0
  • +
  • -

#6 atraub  Icon User is offline

  • Pythoneer
  • member icon

Reputation: 759
  • View blog
  • Posts: 2,010
  • Joined: 23-December 08

Re: writing two python commands in one line in command window

Posted 15 May 2012 - 05:30 AM

try the argparse tutorial, does this help?
Was This Post Helpful? 0
  • +
  • -

#7 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6075
  • View blog
  • Posts: 23,540
  • Joined: 23-August 08

Re: writing two python commands in one line in command window

Posted 15 May 2012 - 09:24 AM

Sounds like you want threading, but if argparse is over your head, then you should forget about this task.
Was This Post Helpful? 0
  • +
  • -

#8 atraub  Icon User is offline

  • Pythoneer
  • member icon

Reputation: 759
  • View blog
  • Posts: 2,010
  • Joined: 23-December 08

Re: writing two python commands in one line in command window

Posted 15 May 2012 - 12:06 PM

I'm hoping he just wants to pass in two args in 1 line, rather than process them simultaneously. I hope I hope.
Was This Post Helpful? 0
  • +
  • -

#9 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6075
  • View blog
  • Posts: 23,540
  • Joined: 23-August 08

Re: writing two python commands in one line in command window

Posted 16 May 2012 - 02:39 AM

I assumed threading based on this:

Quote

actually the task is to write and read serially simultaneously ,there should not be any time gap between them

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1