Answers for "rep in python"

6

python repr

# The repr() function returns a printable representational string of the given object.
>>> var = 'foo'
>>> print(repr(var))
"'foo'"
Posted by: Guest on March-26-2020
2

repr python

"""str() is used for creating output for end user while repr() is mainly used for debugging and development.
repr’s goal is to be unambiguous and str’s is to be readable.
For example, if we suspect a float has a small rounding error, repr will show us while str may not."""

import datetime
today = datetime.datetime.now() 
# Prints readable format for date-time object
print (str(today))
  
# prints the official format of date-time object
print (repr(today))  

Output:

2016-02-22 19:32:04.078030
datetime.datetime(2016, 2, 22, 19, 32, 4, 78030)

From: geeksforgeeks.org
Posted by: Guest on April-04-2021
0

replicate python

a = ['1','2','3','4']
output = [a]*1000
Posted by: Guest on June-06-2020
0

replicate python

> rep(c("A","B"), times=2)
[1] "A" "B" "A" "B"
Posted by: Guest on June-06-2020

Python Answers by Framework

Browse Popular Code Answers by Language