ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

How can you replace string space with a given character in Python?

Given a positive integer num, write a function that returns True if num is a perfect square else False.

user-image
تم إضافة السؤال من قبل Mohamed Raashid
تاريخ النشر: 2023/11/08
Mohamed  Raashid
من قبل Mohamed Raashid

Python

string = "Once in a blue moon";

ch = '-';

#Replace space with specific character ch.

string = string.replace(' ', ch);

print("String after replacing spaces with given character: ");

print(string);

المزيد من الأسئلة المماثلة

هل تحتاج لمساعدة في كتابة سيرة ذاتية تحتوي على الكلمات الدلالية التي يبحث عنها أصحاب العمل؟