Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
String coming up weird
#2
to answer your question - the way you define cmd makes it a tuple, not string. Brackets are not required, as stated in the docs:
Quote:They may be input with or without surrounding parentheses, although often parentheses are necessary anyway (if the tuple is part of a larger expression).
So when you print it - you get tuple (on output tuples are always enclosed in parentheses, so that nested tuples are interpreted correctly)
There are different ways to construct the string, however, if you want to execute command in shell/terminal - look at subprocess.run(). Don't construct string, but pass command and arguments as list.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Messages In This Thread
String coming up weird - by EddiesTech - Mar-15-2020, 04:50 PM
RE: String coming up weird - by buran - Mar-15-2020, 05:02 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to know coming snmp trap version in python pysnmp? ilknurg 0 2,625 Jan-31-2022, 12:16 PM
Last Post: ilknurg
  const or #define coming from C jamie_01 11 3,408 Sep-16-2021, 05:39 PM
Last Post: jefsummers
  Weird SQLAchemy connection string error pawpaw 0 1,520 Jun-28-2020, 10:11 AM
Last Post: pawpaw
  Timer keeps coming up with a non-callable int object birdwatcher 1 3,181 Feb-16-2020, 12:40 PM
Last Post: DeaD_EyE
  Error Message Coming Up When Running Code eddywinch82 0 1,895 Feb-10-2020, 11:48 PM
Last Post: eddywinch82
  need help coming up with a code Staph 0 1,464 Jun-21-2019, 10:06 AM
Last Post: Staph
  Learning python My lists are not coming out right TheMusicMan 3 2,622 Aug-17-2018, 02:45 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

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