Home>
If i create a method that sets a value,
I want to be able to use only strings or integers as arguments.
In that case, how should I set the type hint?
def set_value (self, column: str, value: str): # I want to be able to set not only characters but also numbers
"" "
Set the value.
If the column is already set, the value is overwritten.
"" "
self .__ valueset [column] = value
In the case of java, we could declare as many arguments as the same method name.
I am worried that there is no way.
-
Answer # 1
Related articles
- i don't know how to write python
- please tell me how to write a program to end when the result is executed 5 times [python]
- when i get information with python's telnetlib and write it to a file, extra line breaks are created
- how to write to count the number of specific elements of dictionary values in python3
- python 3x - cannot write file when python3 csv file is open
- how to extract the coordinates in the middle of the red part in python and write it as excel data
- python - i want to write light text in the input box
- how to read and write spreadsheets in python
- i don't know how to write [python requests module] corresponding to [curl -f hoge = ・ ・]
- where to write timesleep in python scraping
- python - django form i want to write a little smarter
- [python] i want to interweave character strings and data with write () of file writing
- python 3x - tkinter i want to write code concisely
- please tell me how to write fast without using for in python
- i don't know how to write a generator (python)
- how to write a python program for the fibonacci sequence
- python - read and write values from another file
- python - about write loop to csv
- how to write sql statements in python
- i want to use python3 mecab and write in the original form
Trends
https://docs.python.org/en/3/library/typing.html#typing.Union
is.