Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
31ef35b8
Kaydet (Commit)
31ef35b8
authored
Mar 25, 1997
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added two new questions about number conversions.
üst
e5a9c8fa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
FAQ
Misc/FAQ
+23
-0
No files found.
Misc/FAQ
Dosyayı görüntüle @
31ef35b8
...
...
@@ -182,6 +182,8 @@ Here's an overview of the questions per chapter:
4.41. Q. How do I delete a file? And other file questions.
4.42. Q. How to modify urllib or httplib to support HTTP/1.1?
4.43. Q. Unexplicable syntax errors in compile() or exec.
4.44. Q. How do I convert a string to a number?
4.45. Q. How do I convert a number to a string?
5. Extending Python
5.1. Q. Can I create my own functions in C?
...
...
@@ -1708,6 +1710,27 @@ compile(), exec or execfile(), it *must* end in a newline. In some
cases, when the source ends in an indented block it appears that at
least two newlines are required.
4.44. Q. How do I convert a string to a number?
A. To convert, e.g., the string '144' to the number 144, import the
module string and use the string.atoi() function. For floating point
numbers, use string.atof(); for long integers, use string.atol(). See
the library reference manual section for the string module for more
details. While you could use the built-in function eval() instead of
any of those, this is not recommended, because someone could pass you
a Python expression that might have unwanted side effects (like
reformatting your disk).
4.45. Q. How do I convert a number to a string?
A. To convert, e.g., the number 144 to the string '144', use the
built-in function repr() or the backquote notation (these are
equivalent). If you want a hexadecimal or octal representation, use
the built-in functions hex() or oct(), respectively. For fancy
formatting, use the % operator on strings, just like C printf formats,
e.g. "%04d" % 144 yields '0144' and "%.3f" % (1/3.0) yields '0.333'.
See the library reference manual for details.
5. Extending Python
===================
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment