اذهب إلى المحتوى

Zeina Almakdisi

الأعضاء
  • المساهمات

    168
  • تاريخ الانضمام

  • تاريخ آخر زيارة

كل منشورات العضو Zeina Almakdisi

  1. مرحبا.. اتعامل مع Google maps api على تحديد مواقع وحساب اقرب مسافة باستخدام java scripts ماهي المكتبات اللازم تحميلها وهل من اقتراحات مصادر او مقالات تساعد في هذا المجال !!
  2. شكرا لك بعد اضافة form.save() اصبح يظهر الخطأ التالي في المتصفح عند ارسال البيانات AttributeError at /accounts/contact_U/ 'ContactU' object has no attribute 'save' علما أن كود Html: {% extends 'base.html' %} {% load static %} {% block body %} <section id="appointment" class="appointment section-bg"> <div class="container"> <form method="POST" > {% csrf_token %} <div class="row"> <div class="col-md-4 form-group"> <input type="text" name="first_name" class="form-control" id="first_name" placeholder="first_name" data-rule="minlen:4" data-msg="Please enter at least 4 chars"> {{form.first_name}} <div class="validate"></div> </div> <div class="col-md-4 form-group mt-3 mt-md-0"> <input type="text" class="form-control" name="last_name" id="last_name" placeholder=" last_name" data-rule="minlen:4" data-msg="Please enter at least 4 chars"> {{form.last_name}} <div class="validate"></div> </div> <div class="col-md-4 form-group mt-3 mt-md-0"> <input type="email" class="form-control" name="email_address" id="email_address" placeholder="email_address" data-rule="email" data-msg="Please enter a valid email"> {{form.email_address}} <div class="validate"></div> </div> </div> {% comment %} <div class="row"> <div class="col-md-4 form-group mt-3"> <input type="datetime" name="subtitle" class="form-control datepicker" id="subtitle" placeholder="Subtitle" data-rule="minlen:4" data-msg="Please enter at least 4 chars"> {{form.subtitle}} <div class="validate"></div> </div> {% endcomment %} <div class="form-group mt-3"> <textarea class="form-control" name="message" rows="5" placeholder="Message (Optional)"></textarea> {{form.message}} <div class="validate"></div> </div> <div class="mb-3"> <div class="loading">Loading</div> <div class="error-message"></div> <div class="sent-message">Your appointment request has been sent successfully. Thank you!</div> </div> <div class="text-center"><button type="submit">Make an Appointment</button></div> </form> </div> </section> {% endblock body %}
  3. مرحبا لدي فورم "تواصل معنا" لايظهر أي رسالة خطأ لكن لايتم ارسال البيانات الى قاعدة البيانات Settings.py INSTALLED_APPS = [ 'import_export', ... ] DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME':'medical', 'USER': 'root', 'PASSWORD':'', 'HOST': '127.0.0.1', 'PORT': '3306', } } admin.py from django.contrib import admin from .models import Profile from import_export.admin import ImportExportModelAdmin # Register your models here. class ProfileAdmin(ImportExportModelAdmin, admin.ModelAdmin): pass admin.site.register(Profile) views.py def contact_U(request): if request.method == 'POST': form = ContactU(request.POST) if form.is_valid(): subject = "Website Inquiry" body = { 'first_name': form.cleaned_data['first_name'], 'last_name': form.cleaned_data['last_name'], 'email': form.cleaned_data['email_address'], 'message':form.cleaned_data['message'], } message = "\n".join(body.values()) try: send_mail(subject, message, 'admin@example.com', ['admin@example.com']) except BadHeaderError: return HttpResponse('Invalid header found.') # return redirect ("accounts:Thanks") form = ContactU() return render(request, 'user/contact_U.html', { 'contact_U' : contact_U, }) forms.py class ContactU(forms.Form): first_name = forms.CharField(max_length = 50) last_name = forms.CharField(max_length = 50) email_address = forms.EmailField(max_length = 150) message = forms.CharField(widget = forms.Textarea, max_length = 2000) class Meta: model = User fields = ('first_name','last_name','email_address','message') جزء من كود HTML: <form method="POST" enctype="multipart/form-data" > {% csrf_token %} <div class="row"> <div class="col-md-4 form-group"> <input type="text" name="first_name" class="form-control" id="first_name" placeholder="first_name" data-rule="minlen:4" data-msg="Please enter at least 4 chars"> {{form.first_name}} <div class="validate"></div> </div> <div class="col-md-4 form-group mt-3 mt-md-0"> <input type="tel" class="form-control" name="email_address" id="email_address" placeholder="email_address" data-rule="minlen:4" data-msg="Please enter at least 2 chars"> {{form.email_address}} <div class="validate"></div> </div>
  4. مرحبا لدي مشكلة في مشروع دجانغو علما أن المشروع كان يعمل سابقا عند تنفيذ الامر python manage.py runserver أو python manage.py migrate يظهر الخطأ from django.core.management import execute_from_command_line ModuleNotFoundError: No module named 'django' ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment? احاول تثبيتها من خلال الامر التالي pip install virtualenv فتظهر الرسالة: Traceback (most recent call last): File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "C:\Users\Lenovo\Desktop\Medical\Scripts\pip.exe\__main__.py", line 4, in <module> File "C:\Users\Lenovo\Desktop\Medical\lib\site-packages\pip\_internal\cli\main.py", line 9, in <module> from pip._internal.cli.autocompletion import autocomplete File "C:\Users\Lenovo\Desktop\Medical\lib\site-packages\pip\_internal\cli\autocompletion.py", line 10, in <module> from pip._internal.cli.main_parser import create_main_parser File "C:\Users\Lenovo\Desktop\Medical\lib\site-packages\pip\_internal\cli\main_parser.py", line 8, in <module> from pip._internal.cli import cmdoptions File "C:\Users\Lenovo\Desktop\Medical\lib\site-packages\pip\_internal\cli\cmdoptions.py", line 24, in <module> from pip._internal.cli.parser import ConfigOptionParser File "C:\Users\Lenovo\Desktop\Medical\lib\site-packages\pip\_internal\cli\parser.py", line 12, in <module> from pip._internal.configuration import Configuration, ConfigurationError File "C:\Users\Lenovo\Desktop\Medical\lib\site-packages\pip\_internal\configuration.py", line 20, in <module> from pip._internal.exceptions import ( File "C:\Users\Lenovo\Desktop\Medical\lib\site-packages\pip\_internal\exceptions.py", line 13, in <module> from pip._vendor.requests.models import Request, Response File "C:\Users\Lenovo\Desktop\Medical\lib\site-packages\pip\_vendor\requests\__init__.py", line 149, in <module> from . import packages, utils File "C:\Users\Lenovo\Desktop\Medical\lib\site-packages\pip\_vendor\requests\utils.py", line 58, in <module> DEFAULT_CA_BUNDLE_PATH = certs.where() File "C:\Users\Lenovo\Desktop\Medical\lib\site-packages\pip\_vendor\certifi\core.py", line 50, in where _CACERT_CTX = get_path("pip._vendor.certifi", "cacert.pem") File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\importlib\resources.py", line 119, in path reader = _common.get_resource_reader(_common.get_package(package)) File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\importlib\_common.py", line 67, in get_package if wrap_spec(resolved).submodule_search_locations is None: File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\importlib\_adapters.py", line 16, in __getattr__ return getattr(self.spec, name) AttributeError: 'NoneType' object has no attribute 'submodule_search_locations' مع العلم قمت بتنصيب و تشغيل مشاريع أخرى قبل إعادة التحقق من عمل مشروعي لا أعرف ما الذي سبب عدم عمله
  5. Traceback (most recent call last): File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\template\utils.py", line 66, in __getitem__ return self._engines[alias] KeyError: 'django' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\Lenovo\Desktop\Medical\Medical\manage.py", line 22, in <module> main() File "C:\Users\Lenovo\Desktop\Medical\Medical\manage.py", line 18, in main execute_from_command_line(sys.argv) File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line utility.execute() File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\__init__.py", line 375, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\base.py", line 323, in run_from_argv self.execute(*args, **cmd_options) File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\base.py", line 361, in execute self.check() File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\base.py", line 387, in check all_issues = self._run_checks( File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\commands\migrate.py", line 65, in _run_checks issues.extend(super()._run_checks(**kwargs)) File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\base.py", line 377, in _run_checks return checks.run_checks(**kwargs) File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\checks\registry.py", line 72, in run_checks new_errors = check(app_configs=app_configs) File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\contrib\admin\checks.py", line 79, in check_dependencies for engine in engines.all(): File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\template\utils.py", line 90, in all return [self[alias] for alias in self] File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\template\utils.py", line 90, in <listcomp> return [self[alias] for alias in self] File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\template\utils.py", line 81, in __getitem__ engine = engine_cls(params) File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\template\backends\django.py", line 27, in __init__ self.engine = Engine(self.dirs, self.app_dirs, **options) TypeError: Engine.__init__() got an unexpected keyword argument 'init_command' C:\Users\Lenovo\Desktop\Medical\Medical>python manage.py migrate System check identified some issues: WARNINGS: ?: (mysql.W002) MySQL Strict Mode is not set for database connection 'default' HINT: MySQL's Strict Mode fixes many data integrity problems in MySQL, such as data truncation upon insertion, by escalating warnings into errors. It is strongly recommended you activate it. See: https://docs.djangoproject.com/en/2.2/ref/databases/#mysql-sql-mode Operations to perform: Apply all migrations: accounts, admin, auth, contenttypes, sessions Running migrations: Applying accounts.0006_profile_join_us...Traceback (most recent call last): File "C:\Users\Lenovo\Desktop\Medical\Medical\manage.py", line 22, in <module> main() File "C:\Users\Lenovo\Desktop\Medical\Medical\manage.py", line 18, in main execute_from_command_line(sys.argv) File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line utility.execute() File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\__init__.py", line 375, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\base.py", line 323, in run_from_argv self.execute(*args, **cmd_options) File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\base.py", line 364, in execute output = self.handle(*args, **options) File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\base.py", line 83, in wrapped res = handle_func(*args, **kwargs) File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\commands\migrate.py", line 232, in handle post_migrate_state = executor.migrate( File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\migrations\executor.py", line 117, in migrate state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial) File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\migrations\executor.py", line 147, in _migrate_all_forwards state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial) File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\migrations\executor.py", line 245, in apply_migration state = migration.apply(state, schema_editor) File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\migrations\migration.py", line 124, in apply operation.database_forwards(self.app_label, schema_editor, old_state, project_state) File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\migrations\operations\fields.py", line 110, in database_forwards schema_editor.add_field( File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\backends\mysql\schema.py", line 44, in add_field super().add_field(model, field) File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\backends\base\schema.py", line 433, in add_field definition, params = self.column_sql(model, field, include_default=True) File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\backends\base\schema.py", line 161, in column_sql default_value = self.effective_default(field) File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\backends\base\schema.py", line 233, in effective_default return field.get_db_prep_save(self._effective_default(field), self.connection) File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\models\fields\__init__.py", line 793, in get_db_prep_save return self.get_db_prep_value(value, connection=connection, prepared=False) File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\models\fields\__init__.py", line 1435, in get_db_prep_value value = self.get_prep_value(value) File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\models\fields\__init__.py", line 1414, in get_prep_value value = super().get_prep_value(value) File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\models\fields\__init__.py", line 1274, in get_prep_value return self.to_python(value) File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\models\fields\__init__.py", line 1375, in to_python parsed = parse_datetime(value) File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\lib\site-packages\django\utils\dateparse.py", line 106, in parse_datetime match = datetime_re.match(value) TypeError: expected string or bytes-like object
  6. models.py from django.db import models from django.contrib.auth.models import User from django.utils.translation import gettext_lazy as _ from django.db.models.signals import post_save from django.utils.text import slugify class Profile(models.Model): user = models.OneToOneField(User , verbose_name=_("user"), on_delete=models.CASCADE) name =models.CharField(_("Name:"),max_length=50) subtitle =models.CharField(_("Who_II:"),max_length=50) address =models.CharField(_("Address:"),max_length=50) address_detial=models.CharField(_("address_detial:"),max_length=50) number_phone =models.CharField(_("number_phone:"),max_length=50) working_hours =models.CharField(_("working_hours:"),max_length=50) waiting_time =models.IntegerField(_("waiting_time"), blank=True, null=True) who_I =models.TextField(_("Who I"),max_length=250, blank=True, null=True) price =models.IntegerField(_("Price is"), blank=True, null=True) facebook =models.CharField(max_length=100,blank=True, null=True) twitter =models.CharField(max_length=100,blank=True, null=True) google =models.CharField(max_length=100,blank=True, null=True) image = models.ImageField(_("Photo Profile"), upload_to='profile', blank=True, null=True) Specialist_doctor=models.CharField(_("Specialist:"),max_length=100, blank=True, null=True) slug =models.SlugField(_("slug"), blank=True, null=True ) def save(self,*args,**kwargs): if not self.slug: self.slug=slugify(self.user.username) super(Profile,self).save(*args,**kwargs) def get_queryset(self): return models.Task.objects.all() class Meta: verbose_name = _("Profile") verbose_name_plural= _("Profiles") def __str__(self): return '%s' %(self.user.username) def create_profile(sender , **kwargs): if kwargs['created']: Profile.objects.create(user=kwargs['instance']) post_save.connect(create_profile , sender=User) urls.py: from django.urls import path from . import views app_name='accounts' urlpatterns = [ path('', views.map, name='map'), path('doctors/', views.doctors_list, name='doctors_list'), path('login/', views.user_login, name='login'), path('signup/', views.signup, name='signup'), path('myprofile/', views.myprofile, name='myprofile'), path('update_profile/', views.update_profile, name='update_profile'), path('<slug:slug>/', views.doctors_detail, name='doctors_detail'), ] views.py: from django.shortcuts import render,redirect from django.contrib.auth.models import User from .models import Profile from .forms import Login_Form,UserCreationForms,UpdateUserForm,UpdateProfileForm from django.contrib.auth import authenticate , login from django.contrib.auth.decorators import login_required def doctors_list(request): doctors = User.objects.all() return render(request, 'user/doctors_list.html',{ 'doctors' : doctors, }) def doctors_detail(request, slug): doctors_detail = Profile.objects.get(slug = slug) return render(request, 'user/doctors_detail.html',{ 'doctors_detail' : doctors_detail, }) def user_login(request): if request.method == 'POST': form = Login_Form() username = request.POST['username'] password = request.POST['password'] user = authenticate(request , username=username , password=password) if user is not None: login(request , user) return redirect('accounts:doctors_list') else: form = Login_Form() return render(request, 'user/login.html',{ 'form':form }) def signup(request): if request.method == 'POST': form = UserCreationForms(request.POST) if form.is_valid(): form.save() username = form.cleaned_date.get('username') password = form.cleaned_date.get('password') user = authenticate(username=username , password=password) login(request,user) return redirect('accounts:doctors_list') else: form = UserCreationForms() return render(request , 'user/signup.html'),{ 'form':form, } @login_required() def myprofile(request): return render(request, 'user/myprofile.html',{ }) def update_profile(request): user_form = UpdateUserForm(instance=request.user) profile_form=UpdateProfileForm(instance=request.user.profile) if request.method == "POST": user_form = UpdateUserForm(request.POST , instance=request.user) profile_form=UpdateProfileForm(request.POST ,request.FILES,instance=request.user.profile) if user_form.is_valid and profile_form.is_valid: user_form.save() profile_form.save() return redirect('accounts:myprofile') return render(request, 'user/update_profile.html',{ 'user_form' : user_form, 'profile_form':profile_form, }) def map(request): return render(request, 'user/map.html',{ })
  7. قمنا بشراء اشتراك البرنامج لامشكلة في ذلك. البرنامج منذ البداية يعمل بشكل صحيح . لكن منذ تثبيته واعادة اقلاع اللابتوب أول مرة يبدء في تثبيت البرنامج مباشرة وعندما اقوم بإيقاف التثبيت تظهر
  8. لدي برنامج قمت بتثبيته يعمل بشكل صحيح ومتصل بالقاعدة لا اخطاء برمجية فيه لكن عند تشغيل الكمبيوتر يطلب تثبيته من جديد علما انني اذا قمت بتثبيته سوف يمسح جميع الداتا ويطلب تثبيت مرة اخرى عند اعادة التشغيل
  9. مرحبا.. لدي مشكلة استخدم Google maps Api ضمن مشروعي رسالة الخطأ تظهر على كامل الصفحة مع السماح لي بالتحكم بالخريطة الصورة توضح المشكلة
  10. شكرا لك على مجهودك لكن البيانات المدخلة كاملة حللت المشكلة على مايبدو المشكلة كانت ب استخدامي للبوتستراب وحصول خطأ باعدادات ال Settings
  11. from django.contrib import admin from django.urls import path,include from django.conf import settings from django.conf.urls.static import static urlpatterns = [ path('admin/', admin.site.urls), path('accounts/',include('accounts.urls',namespace='accounts')), ] if settings.DEBUG is True: urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) أضفت صورة للخطأ
  12. from django.shortcuts import render from django.contrib.auth.models import User from .models import Profile from .forms import Login_Form from django.contrib.auth import authenticate , login from django.contrib.auth.decorators import login_required def doctors_detail(request, slug): doctors_detail = Profile.objects.get(slug = slug) return render(request, 'user/doctors_detail.html',{ 'doctors_detail' : doctors_detail, }) def user_login(request): if request.method == 'POST': form = Login_Form() username = request.POST['username'] password = request.POST['password'] user = authenticate(request , username=username , password=password) if user is not None: login(request , user) return redirect('accounts:doctors_list') else: form = Login_Form() return render(request, 'user/login.html',{ 'form':form })
  13. عند تنفيذ الكود يظهر الخطأ في المتصفح UnboundLocalError at /accounts/login/ local variable 'form' referenced before assignment يظهر الخطأ في الشيفرة التالية: كود html: <form method="POST" enctype="multipart/form-data"> <h4 class="auth-header"> Login</h4> {% crsf_token %} <div class="form-group"> {{form.username|as_crispy_field}} </div> <div class="form-group"> {{form.password|as_crispy_field }} </div> url: path('login/', views.user_login, name='login'), forms: from django import forms from django.contrib.auth.models import User class Login_Form(forms.ModelForm): username=forms.CharField() password=forms.CharField(widget=forms.PasswordInput()) class Meta: model = User fields = ('username', 'password')
  14. نعم قمت مسبقا بكتابة from django.urls import path from . import views app_name='accounts' urlpatterns = [ path('doctors/', views.doctors_list, name='doctors_list'), path('login/', views.user_login, name='login'), path('myprofile/', views.myprofile, name='myprofile'), path('<slug:slug>/', views.doctors_detail, name='doctors_detail'), ]
  15. عند تنفيذ الكود يظهر الخطأ في المتصفح NoReverseMatch at /accounts/doctors/ يظهر الخطأ في الشيفرة التالية: <a href="{% url 'accounts:doctors_detail' doctor.profile.slug %}" > url: path('<slug:slug>/', views.doctors_detail, name='doctors_detail'),
  16. عند تحويل ال Models في دجانغو لمجموعة من Tables باستخدام الامر python manage.py makemigrations يظهر الخطأ ImportError: cannot import name 'ugettext_lazy' from 'django.utils.translation' (C:\Users\Lenovo\Desktop\Medical\lib\site-packages\django\utils\translation\__init__.py) from django.db import models from django.contrib.auth.models import User from django.utils.translation import ugettext_lazy as _ # Create your models here. class Profile(models.Model): user = models.OneToOneField(User , verbose_name=_("user"), on_delete=models.CASCADE) name=models.charField(_("Name:"),max_lengh=50) who_I=models.TextField(_("Who I"),max_lengh=250) price=models.IntegerField(_("Price is"),max_lengh=5) class Meta: verbose_name=_("Profile") verbose_name_plural= _("Profiles") def __str__(self): return self.name
  17. شكرا لك على المقال لكن لتنشيط البيئة الافتراضية يجب استخدام Scripts/activate/. بدل env/bin/activate
  18. كيف استطيع تثبيت حزمة Django ضمن برنامج PyCharm 2021
  19. احاول طباعة العمر الحالي لتاريخ الميلاد المدخل طباعة عدد السنوات فقط لكن يظهر عدد الايام والساعات هل يمكن المساعدة وتوضيح طريقة الحل Import datetime myBrithday = datetime.datetime(2005,7,4) dateNow=datetime.datetime.now() print(dateNow - myBrithday )
  20. myBrithday = datetime.datetime(2000,4,4) dateNow=datetime.datetime.now() print(myBrithday.day)
  21. لدي العديد من الملفات التي تحتوي على توابع واريد استدعائها لكن المشكلة انني قمت باستخدام اسماء طويلة للملفات. **هل يمكن اختصار اسم الملف عند الاستخدام دون تغيره في الملف الاصلي ؟ import information_personal information_personal.Your_age(50) information_personal.Your_age(30) information_personal.Your_age(32) information_personal.Name("Zeina") information_personal.Name("Mary") information_personal.Name("elias")
  22. from random import randint, random print(f"Random float{random()}") print(f"Random int {random(100,120)}")
  23. لدي تابع بلغة بايثون يستقبل معلومات ويقوم بطباعتها لكن لدي مشكلة في بعض المرات لا اريد ادخال المعلومات كاملة مثلا في الكود التالي لا اريد ادخال رقم def info(name,age,country,number): print({f" Hello{name} Your age{age} and your country {country} and {number}") info("zeina" , 22,"egypt", 123654) info("mary" , 20,"egypt")
×
×
  • أضف...