J
J
jundevtut2018-07-25 21:28:09
Python
jundevtut, 2018-07-25 21:28:09

What is it and where can I read "+ name +" Python about it?

Hello! Below is a code example, interested in "+name+", or rather, what is it called and where can I read about such things? There is an understanding that this is a separation of a variable from the text, but here is where it can be used, etc. there is no understanding.

name = input()
print('Здравствуйте, ' + name + '!')

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DevMan, 2018-07-25
@jundevtut

concatenation (connection) of strings

T
Tim, 2018-07-27
@darqsat

In new versions of python, it seems from 3.4 it is already possible to write through A, this is used wherever you need to insert a value into a string. For example, you want to make a request somewhere in the API and there the url is ' myapi.com/users/1/albums ' and when you write a function you will write

def get_user_albums_by_id(id):
    url = f'http://myapi.com/users/{id}/albums'
    r = requests.get(url)
    return r.json()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question