Python Forum
converting arguments or input numbers
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
converting arguments or input numbers
#6
in which world your snippet with eval is better than the other one?

or if you want it with try/except
try:
    number = int(sys.argv[1])
except:
    print('oops!')
    error_count += 1
I also fully agree with Gribouillis that you will be better using package like click or similar...
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
converting arguments or input numbers - by Skaperen - Aug-20-2018, 01:31 AM
RE: converting arguments or input numbers - by buran - Aug-20-2018, 11:11 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  ValueError: Found input variables with inconsistent numbers of samples saoko 0 2,568 Jun-16-2022, 06:59 PM
Last Post: saoko
  Found input variables with inconsistent numbers of samples: [1000, 200] jenya56 2 3,001 Sep-15-2021, 12:48 PM
Last Post: jenya56
  converting user input to float troubles RecklessTechGuy 3 2,552 Aug-17-2020, 12:41 PM
Last Post: deanhystad
  square root of 5 input numbers mrityunjoy 1 2,085 Jun-10-2020, 11:08 AM
Last Post: perfringo
  square root of 6 input numbers mrityunjoy 3 2,707 Jun-07-2020, 06:35 AM
Last Post: ndc85430
  Trouble converting numbers to characters Involute 4 2,597 Sep-12-2019, 04:49 AM
Last Post: Involute
  Print Numbers starting at 1 vertically with separator for output numbers Pleiades 3 3,864 May-09-2019, 12:19 PM
Last Post: Pleiades
  converting python list to a list by user input Dante24 1 3,096 Nov-21-2017, 10:10 AM
Last Post: heiner55
  Functions (Arguments Passing,Changing a mutable ,Assignment to Arguments Names) Adelton 2 3,964 Mar-02-2017, 10:23 PM
Last Post: zivoni

Forum Jump:

User Panel Messages

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