Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

add place in certain index python string

>>> hash = '355879ACB6'
>>> hashlist = list(hash)
>>> hashlist.insert(4, '-')
>>> ''.join(hashlist)
'3558-79ACB6'
Comment

Python Add a string in a certain position

>>> s[:4] + '-' + s[4:]
'3558-79ACB6'
Comment

add place in certain index python string


>>> s='355879ACB6'
>>> s[4:4] = '-'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'str' object does not support item assignment

Comment

PREVIOUS NEXT
Code Example
Python :: cassandra python 
Python :: how to run django in jupyter 
Python :: python rgb to hex 
Python :: how to get int input in python 
Python :: replace outliers with nan python 
Python :: python script as service linux 
Python :: python print green 
Python :: django serialize foreign key, django serializer foreign key 
Python :: seconds to datetime.time 
Python :: dropna threshold 
Python :: random 0 or 1 python 
Python :: python read file into variable 
Python :: python dictionary dynamic key 
Python :: nltk remove more stopwords 
Python :: _ variable in python 
Python :: how to make a nan value in a list 
Python :: Python program to implement linear search and take input. 
Python :: rename in python 
Python :: d-tale colab 
Python :: python capitalize every first letter 
Python :: how to open cmd at specific size using python 
Python :: disable close button in tkinter 
Python :: python array index range 
Python :: python append value to dictionary list 
Python :: labs fill ggplot2 
Python :: python program to print ASCII characters in lowercase 
Python :: word embedding python 
Python :: python keyboard key codes 
Python :: shell script to run python 
Python :: python print without new lines 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =