Python Forum
got SyntaxError while building simple function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
got SyntaxError while building simple function
#3
Thank you for your input :)

My goal was to create simple function which would transfer list into a string ideally (just by passing an argument to function and it would return whole list as string)

Lets say i have
mylist = [ABC, 123, 456] 
Ideally i would like to get '123456'

I know that i can do it on many ways such as:
mylist = mylist.split()[1:3]
mylist = ''.join(mylist)
or:
mylist = mylist[1] + mylist[2]
SOLVED:

Usually it's written more dense:
Python Code: (Double-click to select all)
1
my_new_str = " ".join(your_list)



Thank you.. i am dumb :P
Reply


Messages In This Thread
RE: got SyntaxError while building simple function - by zarize - Feb-14-2020, 10:51 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Sad SyntaxError: from simple python example file from mind-monitor code (muse 2) warmcupoftea 4 2,855 Jul-16-2021, 02:51 PM
Last Post: warmcupoftea
  Building a method name in a function ffgth 9 3,221 Oct-19-2020, 01:21 PM
Last Post: buran
  Learning python SyntaxError: 'return' outside function Grale1953 3 2,530 Aug-03-2020, 06:55 AM
Last Post: buran
  Function: SyntaxError: invalid syntax vejin 2 2,355 Feb-02-2020, 09:25 PM
Last Post: ThiefOfTime
  Simple statistics with range function Pythonlearner2019 2 2,130 Nov-25-2019, 05:25 PM
Last Post: Pythonlearner2019
  Cannot get simple i/o to function. jerryi 10 6,731 Jul-27-2019, 06:22 PM
Last Post: jerryi
  Need help with a simple function WorldPark 4 2,663 Apr-26-2019, 12:28 PM
Last Post: perfringo
  Why this simple function doesnt work? blackknite 8 4,027 Jan-05-2019, 12:32 PM
Last Post: buran
  def function SyntaxError: invalid syntax Said 1 5,914 Jul-10-2018, 10:16 AM
Last Post: Said
  Simple Function Problem, please help ShadowWarrior17 16 7,090 Jan-03-2018, 09:29 PM
Last Post: ShadowWarrior17

Forum Jump:

User Panel Messages

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