Français
Ouvrir dans Telegram

Fil de discussion بخوام اولین حرف یک رشته رو عوض کنم باید چ کنم

10 messages · –
  1. M
    def replace_letter(string, index, new): return string[:index] + new + string[index+1:] def replace_letter2(string, index, new): string = list(string) string[index] = new return ''.join(string)
    1. M
      این دو تا از راه هاشه هزار تا راه دیگه وجود داره
      1. C
        نه منظور من اینه که مثلا بگم حرف اول a که توش یه رشتس رو چجوری عوض کنم؟ مثلا این چشه؟: a='salam' a[0]='d' این چرا نمیشه dalam
        1. M
          منم منظورتون فهمیدم و جوابتون دادم چون string تغییر ناپذیره
        2. C
          چون استرینگه ارایه نیست بالا توضیح دادم باید ارایه بنویسیدش
        3. I
          a = "salam" a = "d" + a[1:] print(a) output : 'dalam'
PPython + Linux ExpertsPython + Linux Experts@PythonLinuxExperts · groupe · Technologie
4 287membres21écrivent en 30 jours
Fil de la communauté Ouvrir dans Telegram

Un fil public ouvert issu de l'index de recherche ChatCrawler — « le Google du Telegram public » ; actualisé à mesure que la communauté est explorée. Les heures sont en UTC.

Contenu public uniquement, API officielle de Telegram. À propos · FAQ · Limites de l'index · Retirer une page · Catalogue · Recherche · Comment nous comptons