The download is free, but we offer some paid services. Support us by subscribing
Delete ads and speed up browsing the library.
The download starts with the click of a button without waiting for the book to be ready.
No limits for download times.
You can upload unlimited books in the library.
Enable readers to download your books without waiting.
Delete ads on the books that you publish.
No problems with download links for your uploaded books.
| Author: | Uploads 2014-2020 |
| Category: | Python & Applications [Edit] |
| Language: | English |
| Pages: | 8 |
| Rank: | 72,816 No 1 most popular |
| Short link: | Copy |
| More books like this book | |
يتناول هذا العمل أساسيات التعامل مع الملفات في لغة بايثون، مع التركيز على دالة `open()` التي تتطلب معلمين أساسيين هما اسم الملف (filename) والوضع (mode). ويفصل النص في أربعة أوضاع مختلفة لفتح الملفات وهي: وضع القراءة `r` وهو القيمة الافتراضية، ووضع الإلحاق `a` لإضافة محتوى في نهاية الملف، ووضع الكتابة `w` الذي يقوم بمسح المحتوى السابق، ووضع الإنشاء `x` الذي يعيد خطأ في حال كان الملف موجوداً مسبقاً، بالإضافة إلى التمييز بين التعامل مع الملفات كـنصوص `t` أو كملفات ثنائية `b`.
يشرح الكتاب كيفية استخراج البيانات من الملفات باستخدام ميثود `read()` لقراءة النص كاملاً أو تحديد عدد معين من الحروف، وميثود `readline()` لقراءة سطر واحد أو عدة أسطر بالتتابع. كما يوضح آلية قراءة الملف بالكامل عبر استخدام الحلقات التكرارية (loop) للتنقل بين الأسطر، ويؤكد على ضرورة استخدام دالة `close()` لإغلاق الملفات لضمان تطبيق التغييرات وتجنب مشاكل التخزين المؤقت (buffering).
يستعرض النص عمليات إدارة الملفات والمجلدات من خلال استيراد وحدة `os` البرمجية، حيث يتم استخدام دالة `os.remove()` لحذف ملف محدد، ودالة `os.rmdir()` لحذف المجلدات الفارغة. كما يتطرق إلى كيفية التحقق من وجود الملف قبل محاولة حذفه باستخدام `os.path.exists()` لتفادي ظهور الأخطاء البرمجية أثناء التنفيذ.
ملف بايثون مفتوح هو دليل إجرائي مباشر يركز على مهارة واحدة محددة دون إطالة. يبتعد المؤلف عن التنظير البرمجي لصالح تقديم خطوات تطبيقية سريعة، مما يجعله أقرب إلى الكتيب الإرشادي منه إلى الكتاب التعليمي الشامل.
الجانب الأكثر نفعاً في الكتاب هو تفصيله الدقيق لأوضاع فتح الملفات؛ حيث يفرق بوضوح بين وضع الإلحاق `a` الذي يحافظ على البيانات، ووضع الكتابة `w` الذي يمسح المحتوى السابق، ووضع الإنشاء `x` الذي يمنع التكرار. كما يطرح حلولاً عملية لاستخراج البيانات عبر ميثود `readline()` لقراءة الأسطر بالتتابع، ويخصص حيزاً لإدارة النظام من خلال وحدة `os` لشرح كيفية حذف المجلدات الفارغة باستخدام `os.rmdir()`.
تجربة القراءة هنا سريعة جداً وغير مجهدة، فالنص مبني على أمثلة برمجية قصيرة تليها ملاحظات تنبيهية. لا يحتاج القارئ إلى خلفية برمجية عميقة، لكن الكتاب يطلب منه صبراً في تطبيق الأكواد يدوياً للتأكد من فهم آلية التخزين المؤقت (buffering) وضرورة إغلاق الملفات عبر دالة `close()` لضمان حفظ التغييرات.
هذا الكتاب موجه للمبتدئين في لغة بايثون الذين يبحثون عن إجابات سريعة ومحددة حول التعامل مع الملفات والمجلدات. أما من يبحث عن شرح معمق لهندسة البرمجيات أو إدارة البيانات الضخمة، فقد يجد المحتوى هنا بسيطاً ومختصراً أكثر من اللازم.
E-books are complementary and supportive of paper books and never cancel it. With the click of a button, the e-book reaches anyone, anywhere in the world.
E-books may weaken your eyesight due to the glare of the screen. Support the book publisher by purchasing his original paper book. If you can access it and get it, do not hesitate to buy it.
Publish your book now for free
We require cookies for this site to function. Please enable them to continue.
نحن نظهر لك هذه الرسالة لأننا نحترم خصوصيتك.
By using this website, you consent to us collecting cookies to provide you with a better user experience,
more details.
You cannot browse the site since you refused the use of cookies, as the site relies primarily on them to work.
Intellectual property is reserved for the authors mentioned on the books and the library is not responsible for the ideas of the authors
Old and forgotten books that have become past to preserve Arab and Islamic heritage are published,
and books that their authors are accepted to published.
The Universal Declaration of Human Rights states: "Everyone has the right freely to participate in the cultural life of the community, to enjoy the arts and to share in scientific advancement and its benefits.Everyone has the right to the protection of the moral and material interests resulting from any scientific, literary or artistic production of which he is the author".