Python Forum
converting string object inside a list into an intiger
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
converting string object inside a list into an intiger
#1
Hi,guys!

import sys
a = sys.argv
a.remove('C:\\Users\\USER\\Desktop\\app\\as4t.py')

print(a)

C:\Users\USER\Desktop\app>as4t.py 1 2 3
['1', '2', '3']

How can i make that output [1, 2, 3]?
Reply
#2
Hi guys!

import sys


a = sys.argv
a.remove('C:\\Users\\USER\\Desktop\\app\\as4t.py')
print(a)

C:\Users\USER\Desktop\app>as4t.py 1 2 3
['1', '2', '3']

How can i make my output[1, 2, 3]?
Reply
#3
listname[index] = int(listname[index])
Reply
#4
@bwdu, Please, use proper tags when post code, traceback, output, etc.
See BBcode help for more info.

also, don't start new threads unnecessarily
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
#5
@bwdu, I strongly advise you to think carefully before posting any further without following Forum Rules or risk permanent ban. Giving negative rep to Moderator for advising you to follow rules is really stupid and childish.
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


Possibly Related Threads…
Thread Author Replies Views Last Post
  how to capitalize letter in list object Python iwonkawa 4 246 May-29-2024, 04:29 PM
Last Post: DeaD_EyE
  Possible to create an object inside another object that is visible outside that objec MeghansUncle2 17 2,682 May-25-2023, 02:08 PM
Last Post: MeghansUncle2
  How do I call sys.argv list inside a function, from the CLI? billykid999 3 904 May-02-2023, 08:40 AM
Last Post: Gribouillis
  add object and name in list 3lnyn0 4 1,367 Nov-24-2022, 07:33 PM
Last Post: buran
  bytearray object - why converting to ascii? Chepilo 2 1,819 Nov-21-2022, 07:25 PM
Last Post: Chepilo
  Converting '1a2b3c' string to Dictionary PythonNoobLvl1 6 1,978 May-13-2022, 03:44 PM
Last Post: deanhystad
  AttributeError: 'list' object has no attribute 'upper' Anldra12 4 5,147 Apr-27-2022, 09:27 AM
Last Post: Anldra12
  AttributeError: 'list' object has no attribute 'values' ilknurg 4 15,382 Jan-19-2022, 08:33 AM
Last Post: menator01
  Need to parse a list of boolean columns inside a list and return true values Python84 4 2,241 Jan-09-2022, 02:39 AM
Last Post: Python84
  Need help converting string to int dedesssse 7 2,806 Jul-07-2021, 09:32 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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