Home » convert string to array python

convert string to array python

how to convert string to char in python?

# To split the string at every character use the list() function
word = 'lov'
L = list(word)
L
# Output:
# ['l', 'o', 'v']

# To split the string at a specific character use the split() function
word = 'l,o,v'
L = word.split(',')
L
# Output:
# ['l', 'o', 'v']

Also Read: python line count
convert string to list of characters python
>>> text = 'p a k'
>>> text = text.split(' ')
>>> text
[ 'p', 'a', 'k' ]

convert string list to list python

s = 'jayde'
l = list(s)
print(l) # prints ['j', 'a', 'y', 'd', 'e']

Read Also:  Paytm Payment Gateway Integration in PHP step By step

Related FAQ

Here are some more FAQ related to this Article:

  1. Read Also:  Laravel 6 Eloquent LEFT JOIN Query Example Tutorial
  2. Read Also:  Get Current date time in laravel Timezone
  3. Read Also:  php artisan clear cache
  4. Read Also:  WordPress Create Plugin From Scratch
  5. Read Also:  Sending Bulk Emails in PHP with PHPMailer
  6. Read Also:  [SOLUTIONS] 504 GATEWAY TIMEOUT NGINX
  7. Read Also:  how to get radio button value using jquery?
  8. Read Also:  Laravel 5.8 Datatables Server Side Processing
  9. Read Also:  How to fix "string was not recognized as a valid datetime"
  10. Read Also:  [SOLUTIONS] 504 GATEWAY TIMEOUT NGINX

Leave a Comment

Your email address will not be published. Required fields are marked *