Python string Addition problem

Source: Internet
Author: User

Today when using Python splicing strings encountered a problem, the data from the database and the time taken to get the data to spell a string a, the string A and the custom string B splicing has been interrupted, unable to continue execution, no error, Trying to get the database out of the data into a custom put to another file, and then try to print out the type of each string, the result is that the timestamp type is float, the database fetch data type is Unicode, and the custom string type is str, Different types of data can not be directly spliced together, you need to convert its first to the same type and then splicing.

T=time.time () h1= ' my Test 1 ' str1=h1+str (t)

Python converts other types to STR only requires a single statement to be implemented, STR (variables that need to be converted)

Python string Addition problem

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.