placeholder in python code example
Example 1: formatted string python
# Newer f-string format
name = "Foo"
age = 12
print(f"Hello, My name is {name} and I'm {age} years old.")
# output :
# Hello, my name is Foo and I'm 12 years old.
Example 2: json placeholder
fetch('https://jsonplaceholder.typicode.com/todos/1')
.then(response => response.json())
.then(json => console.log(json))
Example 3: json placeholder
axios
.get("https://jsonplaceholder.typicode.com/posts")
.then(function (response) {
console.log(response);
})
.catch(function (error) {
// handle error
console.log(error);
})
.then(function () {
// always executed
});
Example 4: python string format
print("My name is {0} and I am {1} years old".format(name, age))