《Python编程:从入门到实践》第九章练习题

python入门到精通 练习题30道(初级) 题目1 编程实现,让用户输入一个整数n,打印输出n以内的全部大于0的偶数(不包含n) # 方法1================================================== # 让用户输入一个数字 num=int(input("请输入一个整数")) # 判断是否满足循环条件,如果满足,则进入循环 while num>0: if num%2 == 0: # 打印数字 print(num) # 修改num的值,让其自减1【目的是 阅读详情

《Python编程:从入门到实践》第九章练习题

9-1 餐馆

创建一个名为Restaurant 的类,其方法__init__() 设置两个属性:restaurant_name 和cuisine_type 。创建一个名 为describe_restaurant() 的方法和一个名为open_restaurant() 的方法,其中前者打印前述两项信息,而后者打印一条消息,指出餐馆正在营业。 根据这个类创建一个名为restaurant 的实例,分别打印其两个属性,再调用前述两个方法。

代码:

class Restaurant():
    def __init__(self, restaurant_name, cuisine_name):
        self.restaurant_name = restaurant_name
        self.cuisine_name = cuisine_name

    def describe_restaurant(self):
        print("\nRestaurant name: " + self.restaurant_name.title())
        print("Cuisine name: " + self.cuisine_name.title())

    def open_restaurant(self):
        print("\n" + self.restaurant_name.title() + " is opening")


restaurant = Restaurant('beijing restaurant', 'traditional food')
print(restaurant.restaurant_name + "," + restaurant.cuisine_name)
restaurant.describe_restaurant()
restaurant.open_restaurant()

9-2 三家餐馆

根据你为完成练习9-1而编写的类创建三个实例,并对每个实例调用方法describe_restaurant() 。

代码:

class Restaurant:
    def __init__(self, restaurant_name, cuisine_name):
        self.restaurant_name = restaurant_name
        self.cuisine_name = cuisine_name

    def describe_restaurant(self):
        print("\nRestaurant name: " + self.restaurant_name.title())
        print("Cuisine name: " + self.cuisine_name.title())

    def open_restaurant(self):
        print("\n" + self.restaurant_name.title() + " is opening")


beijing_restaurant = Restaurant('beijing restaurant', 'beijing food')
lanzhou_restaurant = Restaurant('lanzhou restaurant', 'lanzhou food')
sichuan_restaurant = Restaurant('sichuan restaurant', 'sichuan food')

beijing_restaurant.describe_restaurant()
lanzhou_restaurant.describe_restaurant()
sichuan_restaurant.describe_restaurant()

9-3 用户

创建一个名为User 的类,其中包含属性first_name 和last_name ,还有用户简介通常会存储的其他几个属性。在类User 中定义一个名 为describe_user() 的方法,它打印用户信息摘要;再定义一个名为greet_user() 的方法,它向用户发出个性化的问候。 创建多个表示不同用户的实例,并对每个实例都调用上述两个方法。

代码:

class User:
    def __init__(self, first, last, age, location):
        self.first_name = first
        self.last_name = last
        self.age = age
        self.location = location

    def describe_user(self):
        print("\nUser info:")
        name = self.last_name.title() + " " + self.first_name.title()
        print("\tName: " + name)
        print("\tAge: " + str(self.age))
        print("\tLocation: " + self.location.title())

    def greet_user(self):
        name = self.last_name.title() + " " + self.first_name.title()
        print("\nHi, " + name + "! Nice to see you again!")


zhangsan = User('san', 'zhang', 22, 'shanghai')
lisi = User('si', 'li', 33, 'beijing')
wangwu = User('wu', 'wang', 44, 'sichuan')

zhangsan.describe_user()
zhangsan.greet_user()
lisi.describe_user()
lisi.greet_user()
wangwu.describe_user()
wangwu.greet_user()

9-4 就餐人数

在为完成练习9-1而编写的程序中,添加一个名为number_served 的属性,并将其默认值设置为0。根据这个类创建一个名为restaurant 的实例;打印有多少人在这家餐馆就餐过,然后修改这个值并再次打印它。

添加一个名为set_number_served() 的方法,它让你能够设置就餐人数。调用这个方法并向它传递一个值,然后再次打印这个值。

添加一个名为increment_number_served() 的方法,它让你能够将就餐人数递增。调用这个方法并向它传递一个这样的值:你认为这家餐馆每天可能接待的就餐人数。

代码:

class Restaurant:
    def __init__(self, restaurant_name, cuisine_name):
        self.restaurant_name = restaurant_name
        self.cuisine_name = cuisine_name
        self.number_served = 0

    def describe_restaurant(self):
        print("\nRestaurant name: " + self.restaurant_name.title())
        print("Cuisine name: " + self.cuisine_name.title())
        print("Number served: " + str(self.number_served))

    def open_restaurant(self):
        print("\n" + self.restaurant_name.title() + " is opening")

    def set_number_served(self, number):
        self.number_served = number
        print("Number served: " + str(self.number_served))

    def increment_number_served(self, number):
        self.number_served = number
        print("Number wanter to serve: " + str(self.number_served))


restaurant = Restaurant('beijing restaurant', 'traditional food')
print(restaurant.number_served)
restaurant.number_served = 10
print(restaurant.number_served)

restaurant.set_number_served(20)
restaurant.increment_number_served(30)

9-5 尝试登录次数

在为完成练习9-3而编写的User 类中,添加一个名为login_attempts 的属性。编写一个名为increment_login_attempts() 的方法, 它将属性login_attempts 的值加1。再编写一个名为reset_login_attempts() 的方法,它将属性login_attempts 的值重置为0。

根据User 类创建一个实例,再调用方法increment_login_attempts() 多次。打印属性login_attempts 的值,确认它被正确地递增;然后,调用方 法reset_login_attempts() ,并再次打印属性login_attempts 的值,确认它被重置为0。

代码:

class User:
    def __init__(self, first, last, age, location):
        self.first_name = first
        self.last_name = last
        self.age = age
        self.location = location
        self.login_attempts = 0

    def describe_user(self):
        print("\nUser info:")
        name = self.last_name.title() + " " + self.first_name.title()
        print("\tName: " + name)
        print("\tAge: " + str(self.age))
        print("\tLocation: " + self.location.title())

    def greet_user(self):
        name = self.last_name.title() + " " + self.first_name.title()
        print("\nHi, " + name + "! Nice to see you again!")

    def increment_login_attempts(self):
        self.login_attempts += 1

    def reset_login_attempts(self):
        self.login_attempts = 0


user = User('san', 'zhang', 22, 'shanghai')
for i in range(10):
    user.increment_login_attempts()
print(user.login_attempts)
user.reset_login_attempts()
print(user.login_attempts)

9-6 冰淇淋小店

冰淇淋小店是一种特殊的餐馆。 编写一个名为IceCreamStand 的类, 让它继承你为完成练习9-1或练习9-4而编写的Restaurant 类。 这两个版本的Restaurant 类都可以, 挑选你更喜欢的那个即可。 添加一个名为flavors 的属性,用于存储一个由各种口味的冰淇淋组成的列表。 编写一个显示这些冰淇淋的方法。创建一个IceCreamStand 实例, 并调用这个方法。

代码:

class Restaurant:
    def __init__(self, restaurant_name, cuisine_name):
        self.restaurant_name = restaurant_name
        self.cuisine_name = cuisine_name
        self.number_served = 0

    def describe_restaurant(self):
        print("\nRestaurant name: " + self.restaurant_name.title())
        print("Cuisine name: " + self.cuisine_name.title())
        print("Number served: " + str(self.number_served))

    def open_restaurant(self):
        print("\n" + self.restaurant_name.title() + " is opening")

    def set_number_served(self, number):
        self.number_served = number


class IceCreamStand(Restaurant):
    def __init__(self, restaurant_name, cuisine_name):
        super(IceCreamStand, self).__init__(restaurant_name, cuisine_name)
        self.flavors = ['chocolate', 'strawberry', 'vanilla']

    def show_flavors(self):
        print("\nDifferent flavors in " + self.restaurant_name.title() + ":")
        for flavor in self.flavors:
            print("\t" + flavor.title() + " IceCream")


icecreamStand = IceCreamStand('love live icecream', 'ice cuisine')
icecreamStand.show_flavors()

9-7 管理员

管理员是一种特殊的用户。编写一个名为Admin 的类,让它继承你为完成练习9-3或练习9-5而编写的User 类。添加一个名为privileges 的属性,用于存储一个由字符串(如"can add post" 、“can delete post” 、“can ban user” 等)组成的列表。编写一个名为show_privileges() 的方法,它显示管理员的权限。创建一个Admin 实例,并调用这个方法。

代码:

class User:
    def __init__(self, first, last, age, location):
        self.first_name = first
        self.last_name = last
        self.age = age
        self.location = location
        self.login_attempts = 0

    def describe_user(self):
        print("\nUser info:")
        name = self.last_name.title() + " " + self.first_name.title()
        print("\tName: " + name)
        print("\tAge: " + str(self.age))
        print("\tLocation: " + self.location.title())

    def greet_user(self):
        name = self.last_name.title() + " " + self.first_name.title()
        print("\nHi, " + name + "! Nice to see you again!")

    def increment_login_attempts(self):
        self.login_attempts += 1

    def reset_login_attempts(self):
        self.login_attempts = 0


class Admin(User):
    def __init__(self, first, last, age, location):
        super().__init__(first, last, age, location)
        self.privileges = ["can add post", "can delete post", "can ban user"]

    def show_privileges(self):
        name = self.last_name.title() + " " + self.first_name.title()
        print("\nHello, " + name + "! You have the following privileges:")
        for privilege in self.privileges:
            print("\t" + privilege.title())


admin = Admin('liu', 'zhao', '18', 'chengdu')
admin.show_privileges()

9-8 权限

编写一个名为Privileges 的类,它只有一个属性——privileges ,其中存储了练习9-7 所说的字符串列表。将方法show_privileges() 移到这个类中。在Admin 类中,将一个Privileges 实例用作其属性。创建一个Admin 实例,并使用方法show_privileges() 来显示其权限。

代码:

class Privileges:
    def __init__(self):
        self.privileges = ["can add post", "can delete post", "can ban user"]

    def show_privileges(self):
        print("You have the following privileges:")
        for privilege in self.privileges:
            print("\t" + privilege.title())


class User:
    def __init__(self, first, last, age, location):
        self.first_name = first
        self.last_name = last
        self.age = age
        self.location = location
        self.login_attempts = 0

    def describe_user(self):
        print("\nUser info:")
        name = self.last_name.title() + " " + self.first_name.title()
        print("\tName: " + name)
        print("\tAge: " + str(self.age))
        print("\tLocation: " + self.location.title())

    def greet_user(self):
        name = self.last_name.title() + " " + self.first_name.title()
        print("\nHi, " + name + "! Nice to see you again!")

    def increment_login_attempts(self):
        self.login_attempts += 1

    def reset_login_attempts(self):
        self.login_attempts = 0


class Admin(User):
    def __init__(self, first, last, age, location):
        super().__init__(first, last, age, location)
        self.privileges = Privileges()


admin = Admin('liu', 'zhao', '18', 'chengdu')
admin.privileges.show_privileges()

9-9 电瓶升级

在本节最后一个electric_car.py版本中,给Battery 类添加一个名为upgrade_battery() 的方法。这个方法检查电瓶容量,如果它不是85,就将它设置为85。创建一辆电瓶容量为默认值的电动汽车,调用方法get_range() ,然后对电瓶进行升级,并再次调用get_range() 。你会看到这辆汽车的续航里程增加了。

代码:

class Battery:
    def __init__(self, battery_size=70):
        self.battery_size = battery_size

    def describe_battery(self):
        print("This car has a " + str(self.battery_size) + "-kwh battery.")

    def get_range(self):
        if self.battery_size == 70:
            range = 240
        elif self.battery_size == 85:
            range = 270

        message = "This car can go approximately " + str(range) + " miles on a full charge."
        print(message)

    def upgrade_battery(self):
        if self.battery_size != 85:
            self.battery_size = 85


class Car:
    def __init__(self, make, model, year):
        self.make = make
        self.model = model
        self.year = year
        self.odometer_reading = 0

    def get_descriptive_name(self):
        long_name = str(self.year) + ' ' + self.make + ' ' + self.model
        return long_name.title()

    def read_odometer(self):
        print("This car has " + str(self.odometer_reading) + " miles on it.")

    def update_odometer(self, mileage):
        if mileage >= self.odometer_reading:
            self.odometer_reading = mileage
        else:
            print("You can't roll back an odometer!")

    def increment_odometer(self, miles):
        self.odometer_reading += miles


class ElectricCar(Car):
    def __init__(self, make, model, year):
        super().__init__(make, model, year)
        self.battery = Battery()


my_car = ElectricCar('tesla', 'model s', '2022')
# print(my_car.get_descriptive_name())
# my_car.battery.describe_battery()
my_car.battery.get_range()
my_car.battery.upgrade_battery()
# my_car.battery.describe_battery()
my_car.battery.get_range()

9-10 导入Restaurant类

将最新的Restaurant类存储在一个模块中。在另一个文件中,导入Restaurant类,创建一个Restaurant实例,并调用Restaurant的一个方法,以确认import 语句正确无误。

代码:

Restaurant.py:

class Restaurant:
    def __init__(self, restaurant_name, cuisine_name):
        self.restaurant_name = restaurant_name
        self.cuisine_name = cuisine_name
        self.number_served = 0

    def describe_restaurant(self):
        print("\nRestaurant name: " + self.restaurant_name.title())
        print("Cuisine name: " + self.cuisine_name.title())
        print("Number served: " + str(self.number_served))

    def open_restaurant(self):
        print("\n" + self.restaurant_name.title() + " is opening")

    def set_number_served(self, number):
        self.number_served = number



from restaurant import Restaurant

restaurant = Restaurant('beijing restaurant', 'traditional food')
print(restaurant.restaurant_name + "," + restaurant.cuisine_name)
restaurant.describe_restaurant()
restaurant.open_restaurant()

9-11 导入Admin类

以为完成练习9-8的工作为基础,将User,Privieges和Admin类存储在一个模块中,在创建一个文件,在其中创建一个Admin实例并对其调用方法show_privileges(),以确认一切都能正确的运行。

代码:

user_privileges_admin.py:

class Privileges:
    def __init__(self):
        self.privileges = ["can add post", "can delete post", "can ban user"]

    def show_privileges(self):
        print("\nYou have the following privileges:")
        for privilege in self.privileges:
            print("\t" + privilege.title())


class User:
    def __init__(self, first, last, age, location):
        self.first_name = first
        self.last_name = last
        self.age = age
        self.location = location
        self.login_attempts = 0

    def describe_user(self):
        print("\nUser info:")
        name = self.last_name.title() + " " + self.first_name.title()
        print("\tName: " + name)
        print("\tAge: " + str(self.age))
        print("\tLocation: " + self.location.title())

    def greet_user(self):
        name = self.last_name.title() + " " + self.first_name.title()
        print("\nHi, " + name + "! Nice to see you again!")

    def increment_login_attempts(self):
        self.login_attempts += 1

    def reset_login_attempts(self):
        self.login_attempts = 0


class Admin(User):
    def __init__(self, first, last, age, location):
        super().__init__(first, last, age, location)
        self.privileges = Privileges()
from user_privileges_admin import Admin


admin = Admin('liu', 'zhao', '18', 'chengdu')
admin.privileges.show_privileges()

9-12 多个模块

将User类存储在一个模块中,并将Privileges和Admin类存储在另一个模块中。在创建一个文件,在其中创建一个Admin实例,并对其调用方法show_privileges(),以确认一切都能正确的运行。

代码:

user.py:

class User:
    def __init__(self, first, last, age, location):
        self.first_name = first
        self.last_name = last
        self.age = age
        self.location = location
        self.login_attempts = 0

    def describe_user(self):
        print("\nUser info:")
        name = self.last_name.title() + " " + self.first_name.title()
        print("\tName: " + name)
        print("\tAge: " + str(self.age))
        print("\tLocation: " + self.location.title())

    def greet_user(self):
        name = self.last_name.title() + " " + self.first_name.title()
        print("\nHi, " + name + "! Nice to see you again!")

    def increment_login_attempts(self):
        self.login_attempts += 1

    def reset_login_attempts(self):
        self.login_attempts = 0


privileges_admin.py:

from user import User


class Privileges:
    def __init__(self):
        self.privileges = ["can add post", "can delete post", "can ban user"]

    def show_privileges(self):
        print("\nYou have the following privileges:")
        for privilege in self.privileges:
            print("\t" + privilege.title())


class Admin(User):
    def __init__(self, first, last, age, location):
        super().__init__(first, last, age, location)
        self.privileges = Privileges()

from privileges_admin import Admin


admin = Admin('liu', 'zhao', '18', 'chengdu')
admin.privileges.show_privileges()

9-13 使用OrderedDict

在练习6-4中, 你使用了一个标准字典来表示词汇表。
请使用OrderedDict 类来重写这个程序, 并确认输出的顺序与你在字典中添加键—值对的顺序一致。

代码:

from collections import OrderedDict


vocabulary = OrderedDict()

vocabulary['accumulator'] = '累加器'
vocabulary['algorithm'] = '算法'
vocabulary['array'] = '数组'
vocabulary['branch'] = '分支'
vocabulary['breakpoint'] = '断点'

for word, meaning in vocabulary.items():
    print(word + ":" + meaning)

9-14 骰子

模块random 包含以各种方式生成随机数的函数, 其中的randint() 返回一个位于指定范围内的整数, 例如, 下面的代码返回一个1~6内的整数:

from random import randint
x = randint(1, 6)

请创建一个Die 类, 它包含一个名为sides 的属性, 该属性的默认值为6。
编写一个名为roll_die() 的方法, 它打印位于1和骰子面数之间的随机数。
创建一个6面的骰子, 再掷10次。 创建一个10面的骰子和一个20面的骰子, 并将它们都掷10次。

代码:

from random import randint


class Die:
    def __init__(self, sides=6):
        self.sides = sides

    def roll_die(self):
        x = randint(1, self.sides)
        print(x)


die_6 = Die()
print("\nThe results of a 6-sized die:")
for i in range(10):
    die_6.roll_die()

die_10 = Die(sides=10)
print("\nThe results of a 10-sized die:")
for i in range(10):
    die_10.roll_die()

die_20 = Die(sides=20)
print("\nThe results of a 20-sized die:")
for i in range(10):
    die_20.roll_die()

9-15 Python Module of the Week

要了解Python标准库, 一个很不错的资源是网站Python Module of the Week。请访问http://pymotw.com/并查看其中的目录, 在其中找一个你感兴趣的模块进行探索, 或阅读模块collections 和random 的文档。

代码:

import time

print('The time is      :', time.ctime())
later = time.time() + 15
print('15 secs from now :', time.ctime(later))

运行结果:

在这里插入图片描述

《Python编程:从入门到实践》 练习 9-13 9-14 9-15 练习 9-10 9-11 9-12无任何难度,故不发布 9-13 使用OrderedDict : 在练习6-4中, 你使用了一个标准字典来表示词汇表。 请使用OrderedDict 类来重写这个程序, 并确认输出的顺序与你在字典中添加键—值对的顺序一致。 from collections import OrderedDict word = OrderedDict() word['title']... 阅读详情

相关推荐

Python编程:从入门到实践 练习题

5-10 检查用户名 检查用户名 :按下面的说明编写一个程序,模拟网站确保每位用户的用户名都独一无二的方式。 创建一个至少包含5个用户名的列表,并将其命名为current_users 。 再创建一个包含5个用户名的列表,将其命名为new_users ,并确保其中有一两个用户名也包含在列表current_users 中。 遍历列表new_users ,对于其中的每个用户名,都检查它是否已被使用。如果...

easyboyFcku的博客 1583

《Python编程:从入门到实践》练习题

《Python编程:从入门到实践》练习题

ProgramNovice的博客 2029

Python编程:从入门到实践——练习题答案(第九章)

第9章 类 9-1 餐馆:创建一个名为 Restaurant 的类,其方法__init__()设置两个属性:restaurant_name 和 cuisine_type。创建一个名为 describe_restaurant()的方法和一个名为 open_restaurant()的方法,其中前者打印前述两项信息,而后者打印一条消息,指出餐馆正在营业。 根据这个类创建一个名为 restaurant 的...

森豪Steven的博客 1万+

Python编程从入门到实践-练习9-1

记录Python学习。

Lyric_333的博客 327

《Python 编程:从入门到实践》第九章(类)练习题答案

# -*- coding: GBK -*- #9-1 class Restaurant(): def __init__(self,name,cuisine_type): self.name = name self.cuisine_type = cuisine_type def describe_restaurant(self): print(self.name ,self.cuis...

zenmehaichonga_2009的专栏 1922

*Python编程:从入门到实践 第九章 类的练习题答案 前半部分

Python编程:从入门到实践 第九章 类的练习题答案 9-1 餐馆:创建一个名为Restaurant的类,其方法__init__()设置两个属性:restaurant_name和cuisine_type。创建一个名为describe_restaurant()的方法和一个名为open_restaurant()的方法,其中前者打印前述两项信息,而后者打印一条消息,指出餐馆正在营业。 ![在这里插入图片描述](https://img-blog.csdnimg.cn/20200608 9-2 三家餐馆:根据你为

HOLA_STAR的博客 596

python从入门到实践课后答案第九章_《Python 编程:从入门到实践》第九章(类)练习题答案...

# -*- coding: GBK -*-#9-1class Restaurant():def __init__(self,name,cuisine_type):self.name = nameself.cuisine_type = cuisine_typedef describe_restaurant(self):print(self.name ,self.cuisine_type)def op...

weixin_29763721的博客 457

【《Python编程:从入门到实践》练习题代码实现——第九章】(Geany编写,窗口运行)

第八章 函数 动手试一试代码实现 (1)习题内容 9-1 餐馆:创建一个名为Restaurant的类,其方法__init__()设置两个属性:restaurant_name和cuisine_type。创建一个名为describe_restaurant()的方法和一个名为open_restaurant()的方法,其中前者打印前述两项信息,而后者打印一条信息,指出餐馆正在营业。 ①根据这个类创建一个名...

weixin_45498948的博客 745

《Python编程-从入门到实践》第九章习题训练

本章知识点:1.如何编写类。2.如何使用属性在类中存储信息,编写方法。3.如何编写方法__init()。4.使用继承可简化相关类的创建工作。5.将一个类的实例用作另一个类的属性。6.掌握python标准库的模块。习题:9-1餐馆  9-4就餐人数class Restaurant(): def __init__(self,restaurant_name,cuisine_type,number...

m0_37404802的博客 257

《Python编程:从入门到实践》答案

人生总会有让你不舒服的事,不要在它上纠结,把时间浪费在你想做的事上。 第九章

纸城的博客 3095

[QDS]从零开始,写第一个Qt Design Studio到程序调用的项目

最近在使用Qt Design Studio进行开发,但是简中网上要不就是只搜得到Qt Designer(Qt Creator内部库),要不就只搜得到一点营销号不知道从哪里搬来的账号,鉴于Qt Design Studio是一个这么强大的软件,自然是需要来进行一下小小的实践的。所以开了这篇文章,方便没有使用过Qt Design Studio 和 QML的开发者也可以快速上手QDS(Qt Design Studio)。在本文中,你将学会如何使用QDS开发一个简单的QML程序,与你的C++后端代码进行交流。

Andius的博客 8215

Python编程从入门到实践 学习笔记+练习题答案导航

Python编程从入门到实践 练习题答案导航

Is_Superman的博客 990

SAP ABAP干货:用REUSE_ALV_GRID_DISPLAY_LVC实现ALV多屏幕独立布局(含handle参数详解)

本文详细解析了SAP ABAP中如何使用REUSE_ALV_GRID_DISPLAY_LVC函数实现ALV多屏幕独立布局,重点介绍了handle参数的技术原理和实际应用。通过变式标识符和LTDX表存储机制,开发者可以确保不同ALV报表屏幕的布局设置互不干扰,提升复杂报表场景下的用户体验。

weixin_29268267的博客 312

《Python编程从入门到实践》第九章学习代码笔记

《Python编程从入门到实践》 第九章学习代码笔记

qq_34623480的博客 523

Windows Server远程桌面断开后,PyWinAuto/按键精灵脚本失效?试试这个‘会话保持’的终极配置

本文深入解析Windows Server远程桌面断开后导致PyWinAuto/按键精灵脚本失效的问题,提供会话保持的终极配置方案。通过转换到控制台会话(console模式)和调整组策略,确保自动化程序在断开连接后持续稳定运行,适用于Windows Server各版本。

weixin_28738165的博客 227

05、基于ALV表报实现复选框、全选、取消全选等功能

基于Function ALV实现复选框、全选及取消全选等功能

wo520yl1314的博客 2372

Python编程从入门到实践 第九章:类 练习答案记录

Python编程从入门到实践 第九章:类 练习答案记录

Is_Superman的博客 2265

一文搞定 ST22 短转储 MEMORY_NO_MORE_PAGING:看懂 SAP Paging 机制,参数 rdisp/PG_SHM 与 rdisp/PG_MAXFS 怎么设才稳

SAP系统MEMORY_NO_MORE_PAGING错误通常源于Paging资源耗尽而非物理内存不足。关键排查点包括:通过ST22确认错误类型,ST02监控Paging使用情况,检查工作进程trace中的"no more free blocks"提示。解决方案建议将rdisp/PG_SHM和rdisp/PG_MAXFS设为相同值(如250000块≈2GB),使Paging完全在内存中运行。同时需优化易耗Paging的代码逻辑,如避免滥用EXTRACT命令和超大内存对象传输。典型案例如月末

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 336

python编程从入门到实践第九章——类

python编程从入门到实践第九章——类

beiye_的博客 748

ScanNetV2 数据集讲解和选择性下载

写在前面的话: 不可转载!!!!!!!!!!!! ScanNetV2一共1.2T,数据太大本文会简单讲解如何下载自己想要的文件,并附上修改后的下载程序 ScanNetV2:http://www.scan-net.org/ 简介 ScanNetV2的作者是斯坦福大学的博士,其团队通过收集RGB-D的视频序列,通过ipad应用加深传感器而收集的,然后视频会被上传到服务器,并被自动重建。然后,视频会被给到亚马逊 Mechanical Turk,将标注工作众包出去。ScanNetV2是RGB-D数据集,.

qq_35781447的博客 2万+

智能座舱SoC平台横评:SA8155P、SA8255P、SA8295P、MT8678、MT8628 谁是下代车机首选?

高通SA8295P以PC级架构、强悍AI算力,代表安卓阵营迈向“本地大模型+空间计算”阶段;联发科MT8678则凭借低功耗 + 高带宽,成为副驾多媒体/副屏智能化的性价比之王。在座舱设计中,SoC平台决定了你能给用户什么样的交互方式,选型时切忌只看跑分,而要回归“体验-热设计-平台生态”的三角平衡。

weixin_43199439的博客 3359

【Python编程:从入门到实践】第九章:类

9-1餐馆 :创建一个名为Restaurant 的类,其方法__init__() 设置两个属性:restaurant_name 和cuisine_type 。创建一个名 为describe_restaurant() 的方法和一个名为open_restaurant() 的方法,其中前者打印前述两项信息,而后者打印一条消息,指出餐馆正在营业。 class Restraurant(): """d

HandSome Girl 1万+

RabbitMQ高级特性 - 生产者消息确认机制

为了保证信息 从生产者 发送到 队列,因此引入了生产者的消息确认机制.通过事务机制实现.通过发送确认机制(confirm 和 return)实现.因为事务机制比较消耗性能,在实际工作中用的也不多,因此这里主要介绍confirm 和 return机制来实现发送放的确认.a)confirm 确认模式如上图,confirm 确认模式主要保障于 生产者 到 交换机 的消息可靠性.如果 Exchange成功收到消息,那么 ConfirmCallback 这个回调 ack 参数就为true。

CYK_byte的博客 1886

Python编程从入门到实践课后答案:第九章

9-1 餐馆 :创建一个名为Restaurant 的类,其方法__init__() 设置两个属性:restaurant_name 和cuisine_type 。创建一个名 为describe_restaurant() 的方法和一个名为open_restaurant() 的方法,其中前者打印前述两项信息,而后者打印一条消息,指出餐馆正在营业。 根据这个类创建一个名为restaurant 的实例,分别...

weixin_41827268的博客 7539

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

【python编程从入门到到实践】第九章类

本文介绍了Python中类的创建、使用、继承、导入以及编程风格。首先,类名应首字母大写,使用双下划线定义__init__方法。通过类可以创建实例,访问属性和调用方法。类可以继承父类,子类可以定义新属性和方法,并重写父类方法。类可以从模块中导入,支持导入单个类、多个类或整个模块。Python标准库提供了丰富的功能,如random模块的randint()函数。编程风格上,类名应首字母大写且不使用下划线,实例名和模块名应全小写并使用下划线,每个类定义后应添加文档字符串。

2402_86344613的博客 717

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

上一篇: 《Python编程:从入门到实践》第八章练习题
下一篇: 《Python编程:从入门到实践》第十章练习题
UestcXiye
博客等级 码龄8年 9031粉丝 1306原创
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

UestcXiye

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值